home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir43
/
med300.zip
/
MESCREEN.CLA
< prev
next >
Wrap
Text File
|
1994-02-22
|
11KB
|
210 lines
!▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
!█ █
!█ MESCREEN.CLA █
!█ Screen and cursor-related procedures █
!█ █
!█ Revision Number: 1 █
!█ Revision Date : 22-Feb-94 █
!█ █
!█ Revision History █
!█ 1 Created █
!█ █
!▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
MEMBER('MEMOEDIT')
!─────────────────────────────────────────────────────────────────────────
! Local Module MAP
!─────────────────────────────────────────────────────────────────────────
MAP
ME_FormLine( USHORT, USHORT )
.
!─────────────────────────────────────────────────────────────────────────
! Local Module Data
!─────────────────────────────────────────────────────────────────────────
sLine STRING(512) ! Display line buffer
aLine BYTE,DIM(512),OVER(sLine) ! Array alias for above
!═════════════════════════════════════════════════════════════════════════
! Position cursor, scrolling screen if necessary
!═════════════════════════════════════════════════════════════════════════
ME_CurPos PROCEDURE
! Locals:
isDspCol SHORT ! Display column
isSkewDelta SHORT ! Horizontal pan delta
CODE
isSkewDelta = 0.25 * (MED:ubWndCols - 1) ! Set horizontal pan delta
IF MED:usLineNdx <= MED:usPageTop ! If position above
MED:usPageTop = MED:usLineNdx - 1 ! Set to first row
ME_SetPage() ! Screen needs refresh
! Else if position below
ELSIF MED:usLineNdx > (MED:usPageTop + MED:ubWndRows)
IF MED:usLineNdx < MED:ubWndRows !
MED:usPageTop = 0 !
ELSE !
MED:usPageTop = MED:usLineNdx - MED:ubWndRows
. !
ME_SetPage() ! Screen needs refresh
. ! Endif
isDspCol = MED:usPosition - MED:usLineStart !
IF isDspCol < MED:isSkew ! If off screen left
MED:isSkew = isDspCol - isSkewDelta ! Scroll left
IF MED:isSkew < 0 THEN MED:isSkew = 0. !
ME_SetPage() ! Screen needs refresh
ELSIF isDspCol > MED:isSkew + (MED:ubWndCols -1)! Else if off screen right
MED:isSkew = isDspCol - (MED:ubWndCols - 1) + isSkewDelta
ME_SetPage() ! Screen needs refresh
. ! Endif
ME_ShowPage() ! Display page
MEG:ubCursCol = 1 + (MED:ubWndColOfs + (isDspCol - MED:isSkew))
MEG:ubCursRow = MED:ubWndRowOfs + (MED:usLineNdx - MED:usPageTop)
SETCURSOR(MEG:ubCursRow, MEG:ubCursCol) ! Show cursor
ME_CurSize( MED:bbInsertMode ) ! Set cursor size
RETURN !
!═════════════════════════════════════════════════════════════════════════
! Set cursor size
!═════════════════════════════════════════════════════════════════════════
ME_CurSize PROCEDURE( bbInsertMode )
! Locals:
sCursorSize STRING('<07><06><07><04>') ! Cursor sizes
aCursorSize SHORT,DIM(2),OVER(sCursorSize) !
gRegisters GROUP ! CPU Registers
usAX USHORT !
usBX USHORT !
usCX USHORT !
usDX USHORT !
usSI USHORT !
usDI USHORT !
usCFlag USHORT !
usFlags USHORT !
. !
gSegRegs GROUP ! CPU Segment Registers
usES USHORT !
usCS USHORT !
usSS USHORT !
usDS USHORT !
. !
CODE
CLEAR(gRegisters) ! Clear group
usAX = 0100H ! Set Cursor Size request
usCX = aCursorSize[1+bbInsertMode] ! Select cursor size
Junk# = Int86x(10H, gRegisters, gRegisters, gSegRegs)
RETURN !
!═══════════════════════════════════════════════════════════════════════
! Set the current page to redisplay on the next call to ME_ShowPage()
!═══════════════════════════════════════════════════════════════════════
ME_SetPage PROCEDURE
! Locals:
usLines USHORT ! Line count
usIndex USHORT ! Loop index
CODE
usLines = ME_Min(MED:ubWndRows, (RECORDS(qLine) - MED:usPageTop))
LOOP usIndex = 1 TO usLines ! Loop for each line on page
GET(qLine, MED:usPageTop + usIndex) ! Get line table entry
QLN:bbRedisplay = 1 ! Set display flag
PUT(qLine) ! Store back to table
. ! End loop
RETURN
!═══════════════════════════════════════════════════════════════════════
! Format Display Line
!═══════════════════════════════════════════════════════════════════════
ME_FormLine PROCEDURE( usStartOfs, usEndOfs )
! Locals:
usFillWord USHORT ! Fill character/attribute
isBlkBeg SHORT ! Block begin
isBlkEnd SHORT ! Block end
usSourceNdx USHORT ! Source index
usDestNdx USHORT ! Destination index
ubAttrib BYTE ! Attribute byte
ubChar BYTE ! Character code
CODE
usFillWord = BSHIFT(MED:ubTextColor, 8) + 20H ! Set line to fill character
CMemWSet(ADDRESS(aLine), usFillWord, SIZE(aLine) / 2)
usDestNdx = 1 ! Set dest. index
LOOP usSourceNdx = usStartOfs TO usEndOfs ! Loop thru range
ubAttrib = MED:ubTextColor ! Set attribute
ubChar = ME_GetChar(usSourceNdx) ! Get character
IF MED:bbShowCodes ! Remap format codes
IF ubChar = eHRt !
ubChar = eHRtSym !
ubAttrib = MED:ubSymColor !
. . !
aLine[usDestNdx] = ubChar ! Set character byte
usDestNdx += 1 ! Update dest. index
IF MED:bbBlockShow ! Handle block marking
isBlkBeg = ME_Min(MED:isBlockBegin, MED:isBlockEnd)
isBlkEnd = ME_Max(MED:isBlockBegin, MED:isBlockEnd)
IF INRANGE(usSourceNdx, isBlkBeg, isBlkEnd)!
ubAttrib = MED:ubBlockColor !
. . !
aLine[usDestNdx] = ubAttrib ! Set attribute byte
usDestNdx += 1 ! Update dest. index
. ! End loop
RETURN
!═══════════════════════════════════════════════════════════════════════
! Display screen page
!═══════════════════════════════════════════════════════════════════════
ME_ShowPage PROCEDURE
! Locals:
usIndex USHORT ! Loop index
usDspRow USHORT ! Display row
usDspCol USHORT ! Display column
usDspCols USHORT ! Display columns
usStartOfs USHORT ! Starting offset
usEndOfs USHORT ! Ending offset
usStrLen USHORT ! String length
usCodeOfs USHORT ! Format code offset
CODE
LOOP usIndex = 1 TO MED:ubWndRows ! Loop for each line on page
sLine = '' ! Clear line buffer
usDspRow = MED:ubWndRowOfs + usIndex ! Set display values
usDspCol = MED:ubWndColOfs + 1 !
usDspCols = MED:ubWndCols !
CLEAR(qLine) ! Get line table entry
GET(qLine, MED:usPageTop + usIndex) !
IF ERRORCODE() ! Display blank if not found
QShow(sLine, usDspRow, usDspCol, usDspCols, MED:ubTextColor, 01H)
ELSIF QLN:bbRedisplay ! Else
QLN:bbRedisplay = 0 ! Clear display flag
PUT(qLine) !
usStartOfs = QLN:usLineStart + MED:isSkew ! Calculate offsets
usEndOfs = ME_LineEnd(MED:usPageTop + usIndex)
IF usStartOfs > usEndOfs ! If blank line
QShow(sLine, usDspRow, usDspCol, usDspCols, MED:ubTextColor, 01H)
ELSE ! Else
usEndOfs = ME_Min(usEndOfs, usStartOfs + MED:ubWndCols)
ME_FormLine(usStartOfs, usEndOfs) ! Format and display
QShow(sLine, usDspRow, usDspCol, usDspCols, 0, 80H)
. . . ! End loop
RETURN